package dk.controlme.lego.tester;

import javax.swing.*;
import java.awt.*;
import java.awt.event.KeyEvent;

public class ViewMain extends JFrame {
    private static final long serialVersionUID = -3141592653589793238L;
    public JPanel panel;
    public JButton buttonLeft, buttonRight, buttonForward, buttonBackward, buttonStop;

    public ViewMain() {
        setSize(250,130);
        setTitle("ControlMe.DK test controller");
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        setVisible(true);

        Toolkit toolkit = getToolkit();
        Dimension dimension = toolkit.getScreenSize();
        setLocation((dimension.width - getWidth()) / 2,
                    (dimension.height - getHeight()) / 2);

        JPanel panel = new JPanel();
        getContentPane().add(panel);
        panel.setLayout(null);
        panel.setFocusable(true);

        /*************************
         *       [CONNECT]       *
         *                       *
         *       [FORWARD]       *
         *                       *
         * [LEFT]        [RIGHT] *
         *                       *
         *       [BACKWARD]      *
         *                       *
         *************************/

        buttonForward = new JButton("Forward");
        buttonForward.setMnemonic(KeyEvent.VK_UP);
        buttonForward.setBounds(85,35,75,25);
        panel.add(buttonForward);

        buttonLeft = new JButton("Left");
        buttonLeft.setMnemonic(KeyEvent.VK_LEFT);
        buttonLeft.setBounds(5,65,75,25);
        panel.add(buttonLeft);

        buttonRight = new JButton("Right");
        buttonRight.setMnemonic(KeyEvent.VK_RIGHT);
        buttonRight.setBounds(165,65,75,25);
        panel.add(buttonRight);

        buttonBackward = new JButton("Backward");
        buttonBackward.setMnemonic(KeyEvent.VK_DOWN);
        buttonBackward.setBounds(85,95,75,25);
        panel.add(buttonBackward);
    }
}
